// require('./config')
// const webpack=require('webpack');
const config = {
    /*
    ** Headers of the page
    */
    head: {
        title: '云南国际物流云',
        meta: [
            { charset: 'utf-8' },
            { name: 'viewport', content: 'width=device-width, initial-scale=1' },
            { hid: 'description', name: 'description', content: '云南国际物流云介绍' },
            { name: 'keywords', content: '国际物流云,物流云,物流' }
        ],
        script: [
            { src: 'https://cdn.bootcss.com/babel-polyfill/7.0.0-beta.49/polyfill.min.js' },
            { src: "https://api.map.baidu.com/api?v=3.0&ak=20480eb5ebe60b5b3c12178317758876&s=1" },
        ],
        link: [
            { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
        ]
    },
    css: [
        // { src: 'element-ui/lib/theme-chalk/index.css' },
    ],
    plugins: [
        '~/plugins/lodash', 
        '~/plugins/axios', 
        { src: '~plugins/antd', ssr: true }, 
        { src: '~plugins/components', ssr: true }, 
        '~/plugins/vue-lazyload', 
        '~/plugins/vue-moment', 
        '~/plugins/replaceState',
        {src: '~plugins/apexcharts', ssr: false}
    ],
    /*
    ** Customize the progress bar color
    */
    loading: { color: '#3B8070' },
    /*
    ** Build configuration
    */
    build: {
        vendor: [
            'axios',
            'ant-design-vue'
        ],
        // plugins: [
        //     new webpack.ProvidePlugin({
        //         $: 'jquery',
        //         jQuery: 'jquery',
        //         'window.jQuery': 'jquery'
        //     })
        // ],
        babel: {
            plugins: [['component', [
                {
                    'libraryName': 'ant-design-vue',
                    'styleLibraryName': 'style'
                },
                'transform-async-to-generator',
                'transform-runtime'
            ]]],
            comments: false
        },
        loaders: {
            test: /\.(png|jpe?g|gif|svn)$/,
            loader: "url-loader",
            query: {
                limit: 30000,
                name: 'img/[name].[hash].[ext]'
            }
        },

        /*
        ** Run ESLint on save
        */
        extend(config, { isDev, isClient }) {
            const sassResourcesLoader = {
                loader: 'sass-resources-loader',
                options: {
                    resources: [
                        'assets/global.scss'
                    ]
                }
            }
            if (isDev && isClient) {
                config.module.rules.push({
                    enforce: 'pre',
                    test: /\.(js|vue)$/,
                    loader: 'eslint-loader',
                    exclude: /(node_modules)/
                })
            }
        }
    },
    /*
    ** router  改变时调用
    */
    router: {
        // base: '/ynwly/',
        //middleware: 'scroll'
        middleware: [
            'scroll',
            'authenticated'
        ]
    },

    modules: []
}


const useProxy = +(process.env.AXIOS_PROXY) === 1

const axiosConfig = {
    baseURL: 'http://124.207.149.202',
    // baseURL: 'http://10.6.4.247:9527'
    // baseURL: 'http://10.6.7.197:9527',
    // baseURL: 'http://10.23.102.191:9527',
	
}
// console.log('process.env.AXIOS_PROXY:',useProxy,process.env.AXIOS_PROXY)
// if (useProxy) {
//     axiosConfig.browserBaseURL = '/'
//     axiosConfig.baseURL = 'http://124.207.149.202'
//     axiosConfig.proxyHeaders = false
// }

config.env = {
    useProxy
}

config.modules.push([
    '@nuxtjs/axios', axiosConfig
])

module.exports = config
